#include "../../User.h"
#include "../../NLogic/Space.h"
#include "../../NLogic/Function.h"
#include "world.h"

namespace ProjectZ { namespace NCommand { namespace NWorld {

void CS_REQ_USER_EQUIP_ITEM_INFO::OnExecute(User * pUser, ::Network::Packet * pPacket)
{
	PREPARE_PACKET;

	int gid = 0;
	*pPacket >> gid;

	DEBUGLOG("CS_REQ_USER_EQUIP_ITEM_INFO GID : %d, gid=%d", pUser->GetUserSeq(), gid );

	NLogic::Space * pSpace = pUser->GetSpace();
	if (NULL == pSpace)
	{
		DEBUGLOG("CS_REQ_USER_EQUIP_ITEM_INFO NULL == pSpace");
		return;
	}

	User * pTargetUser = NULL;

	if (gid != static_cast<int>(pUser->GetUserSeq()) )
	{
		pTargetUser = pSpace->FindUser(gid);
		if( pTargetUser == NULL )
		{
			DEBUGLOG("CS_REQ_USER_EQUIP_ITEM_INFO NOT FOUND USER");
			return;
		}
	}

	if (NULL == pTargetUser)
	{
		DEBUGLOG("GID \t%d CS_REQ_USER_EQUIP_ITEM_INFO target user %d not exist", pUser->GetUserSeq(), gid);
		return;
	}

	NLogic::NFunction::SendCharacterEquipInfo(pTargetUser, pUser);
}

} /*NWorld*/ } /*NCommand*/ } /*ProjectZ*/
